<?php
/**
 *
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2019/5/28 14:35
 * @copyright PanxSoft Inc.
 */

use App\Http\Controllers\App\V1\AppVersionController;
use App\Http\Controllers\App\V1\AreaCodeController;
use App\Http\Controllers\App\V1\BulletinBoardController;
use App\Http\Controllers\App\V1\DeviceController;
use App\Http\Controllers\App\V1\DevicePresetController;
use App\Http\Controllers\App\V1\RegisterAgreementController;
use App\Http\Controllers\App\V1\SplashAdvertController;
use App\Http\Controllers\App\V1\ThirdPartyLoginController;
use App\Http\Controllers\App\V1\UserController;
use App\Http\Controllers\App\V1\UserDeviceController;
use App\Http\Controllers\App\V1\UserDevicePresetController;
use App\Http\Controllers\App\V1\UserLoginController;
use App\Http\Controllers\App\V1\UserSkinDetectController;

use App\Models\User;
use Illuminate\Support\Facades\Route;

Route::group([
    'middleware' => ['LocaleEnv']
], function () {

/**
 * @see UserLoginController::verifyCode()
 */
Route::post('/user-login/verify-code', 'UserLoginController@verifyCode')
    ->name(UserLoginController::ROUTES['verifyCode']);

/**
 * @see UserLoginController::emailVerifyCode()
 */
Route::post('/user-login/email-verify-code', 'UserLoginController@emailVerifyCode')
    ->name(UserLoginController::ROUTES['emailVerifyCode']);

/**
 * @see AreaCodeController::index()
 */
Route::get('/area-code', 'AreaCodeController@index')
    ->name(AreaCodeController::ROUTES['index']);

/**
 * @see AppVersionController::index()
 */
Route::resource('/app-version', 'AppVersionController')
    ->names(AppVersionController::ROUTES);

/**
 * @see AppVersionController::showLatest()
 */
Route::get('/app-version-latest', 'AppVersionController@showLatest')
    ->name(AppVersionController::ROUTES['showLatest']);

/**
 * @see RegisterAgreementController::index()
 */
Route::get('/register-agreement', 'RegisterAgreementController@index')
    ->name(RegisterAgreementController::ROUTES['index']);

/**
 * @see UserLoginController::login()
 */
Route::post('/user-login', 'UserLoginController@login')
    ->name(UserLoginController::ROUTES['login']);

/**
 * @see ThirdPartyLoginController()
 */
Route::resource('/third-party-login', 'ThirdPartyLoginController')
    ->names(ThirdPartyLoginController::ROUTES);

/**
 * @see SplashAdvertController::index()
 */
Route::get('/splash-advert', 'SplashAdvertController@index')
    ->name(SplashAdvertController::ROUTES['index']);

/**
 * @see SplashAdvertController::indexInApp()
 */
Route::get('/in-app-advert', 'SplashAdvertController@indexInApp')
    ->name(SplashAdvertController::ROUTES['indexInApp']);

/**
 * @see BulletinBoardController::index()
 */
Route::get('/bulletin-board', 'BulletinBoardController@index')
    ->name(BulletinBoardController::ROUTES['index']);
});


Route::group([
    'middleware' => ['LocaleEnv:'. User::GUARD_NAME , 'AppAuth']
], function () {
    /**
     * @see UserController
     */
    Route::get('/user/info', 'UserController@checkoutUserWithToken');
    Route::resource('/user', 'UserController')
        ->names(UserController::ROUTES);
    
    

    /**
     * @see UserSkinDetectController
     */
    Route::resource('/user-skin', 'UserSkinDetectController')->names(UserSkinDetectController::ROUTES);
    /**
     * 获取所有的肤质列表
     */
    Route::get('/user-skin-list', 'UserSkinDetectController@indexList');
    /**
     * @see UserDeviceController
     */
    Route::resource('/user-device', 'UserDeviceController')
        ->names(UserDeviceController::ROUTES);

    /**
     * @see DevicePresetController
     */
    Route::get('/device-preset', 'DevicePresetController@index')
        ->name(DevicePresetController::ROUTES['index']);

    /**
     * @see UserDevicePresetController
     */
    Route::resource('/user-device-preset', 'UserDevicePresetController')
        ->names(UserDevicePresetController::ROUTES);

    /**
     * @see DeviceController
     */
    Route::resource('/device', 'DeviceController')
        ->names(DeviceController::ROUTES);
});
